package demo4.controller;


import demo4.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Scanner;

@Component
public class UserController {
    @Autowired
    private UserService userService;

    public void start(){
        System.out.println("请输入 对应操作的序号：");
        System.out.println("1:注册        2:登录        3:修改信息      4:用户列表      5:删除用户");
        int num = Integer.parseInt(new Scanner(System.in).nextLine());
        switch (num){
            case 1:
                userService.register();
                break;
            case 2:
                userService.login();
                break;
            case 3:
                userService.updateUser();
                break;
            case 4:
                userService.listUser();
                break;
            case 5:
                userService.deleteUser();
                break;
            default:
                System.out.println("要听话！咱不输入其它数字 ^_^");
        }
    }

}
